package com.njupt.controller;

import com.njupt.common.pojo.EasyUIDataGridResult;
import com.njupt.common.pojo.TaotaoResult;
import com.njupt.content.service.ItemContentService;
import com.njupt.pojo.TbContent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Author: XJL
 * @Description:商品内容
 * @Date: Create in 10:07 2018/5/29
 * @Modified By:
 **/
@Controller
public class ContentController {

    @Autowired
    private ItemContentService itemContentService;

    /**
     * 内容分页展示，根据parentId查询
     * @param categoryId
     * @param
     * @param rows
     * @return
     */
    @ResponseBody
    @RequestMapping("/content/query/list")
    public EasyUIDataGridResult getItemContents(Long categoryId,Integer page,Integer rows){
        System.out.println("categoryId:"+categoryId+"page:"+page+"rows:"+rows);
        EasyUIDataGridResult result = itemContentService.getContentByPage(categoryId,page,rows);

        return result;
    }

    /**
     * 商品内容新增
     * @param
     * @return
     */
    @ResponseBody
    @RequestMapping("/content/save")
    public TaotaoResult addContent(TbContent content){
    TaotaoResult result = itemContentService .addContent(content);
        return result;
    }
}


